package com.ichart.doc;

public class ComponentUtils {
	
	
	
	public static String getFileName(String name){
		name = name.toLowerCase();
		name = name.replaceAll("\\.", "_");
		return name + Info.SUFFIX;
	}
	
	public static String getLowerCaseClassName(String name){
		return getClassName(name).toLowerCase();
	}
	
	public static String getClassName(String name){
		if(name.indexOf(".")!=-1){
			return name.substring(name.indexOf(".")+1);
		}
		return name;
	}
	
	public static String getLocalLink(String name,String clazz){
		return "<a href=\""+ComponentUtils.getFileName(name)+"\" class=\""+clazz+"\" >"+ComponentUtils.getClassName(name)+"</a>";
	}
	
	public static String getFullLink(String name){
		if(name.equalsIgnoreCase("object")){
			return name;
		}
		return "<a href=\""+ComponentUtils.getFileName(name)+"\" target=\"main\" >"+name+"</a>";
	}
	
	public static String getLink(String name){
		if(name.equalsIgnoreCase("object")){
			return name;
		}
		return "<a href=\""+ComponentUtils.getFileName(name)+"\" target=\"main\" >"+ComponentUtils.getClassName(name)+"</a>";
	}
	
}
